import { defineStore } from 'pinia'
import getCategoryId from '../api/categoryId'

export const useCategoryIdStore = defineStore('categoryId', {
  state: () => ({
    data: {}
  }),
  actions: {
    async fetchGetCategoryId(id) {
      try {
        const res = await getCategoryId(id)
        if (Object.keys(res).length > 0) {
          this.data = res.data
        }
      } catch (error) {
        console.error('获取详情数据失败：', error)
      }
    }
  }
})
